import java.util.Scanner;


public class BinSearch {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		System.out.print("Bitte geben Sie die gesuchte Zahl ein: ");
		Scanner scanner = new Scanner(System.in);
		int number = scanner.nextInt();
		
		int[] numbers = new int[] { 1, 2, 3, 4, 6, 7, 8, 10, 11, 12, 14, 15, 16 };
		boolean foundNumber = false;
		
		int max = numbers.length - 1;
		int min = 0;
		
		while (min <= max) 
		{
			final int middle = min + ((max - min) / 2);
		
			if (number > numbers[middle])
				min = middle + 1;
			else if (number < numbers[middle])
				max = middle - 1;
			else
			{
				foundNumber = true;
				break;
			}
		}
		if (foundNumber)
			System.out.println(min + ((max - min) / 2));
		else
			System.out.println(-1);
	}

}
